<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!-- 导入JSTL标签库 -->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
  <head>
    <title>用户登录</title>
  </head>
  <!-- JavaScript 验证 -->
  <script language="javascript">  	 
  	  function checkForm(form) {
  	  	if(isEmpty(form.uid.value)) {
  	  		alert("用户名不能为空！");
  	  		return false;
  	  	}
  	  	if(isEmpty(form.password.value)) {
  	  		alert("用户密码不能为空！");
  	  		return false;
  	  	}
  	  	return true;
  	  }
  	  
  	  function isEmpty(str) {
  		if(str == null || str.length==0) 
  			return true;
  		else 
  			return false;
  	  }
  </script>
  
  <body>    
     
     <form id="userLoginForm" name="userLoginForm" method="post" action="LoginServlet" onsubmit="return checkForm(this)">
    	<table width="55%" border="0" align="center" cellpadding="2" cellspacing="0">
    		<caption><font color="blue" style="font-size:20px"><br><br><strong>用户登录</strong><br><br></font></caption>
    		<tr bgcolor="#EFEFEF">
    			<td width="25%" align="right">用户名：</td>
    			<td width="30%" valign="bottom" ><input type="text" name="uid" id="uid" size="20" maxlength="50"></td>    			
    		</tr>   
    		    
    		<tr>    <!-- 实现空行 -->		
    		<td  align="center">&nbsp;</td>
    		</tr>
    				
    		<tr>
    			<td align="right">密&nbsp;&nbsp;码：</td>
    			<td><input type="password" name="password" id="password" size="20" maxlength="50"></td>    			
    		</tr>    		
    		
    		<tr>    <!-- 实现空行 -->		
    		<td  align="center">&nbsp;</td>
    		</tr>
    		
    		
    		<tr>
    			<td colspan="3" align="center">
    			<input type="submit"name="Submit" value="提交" >&nbsp;&nbsp;&nbsp;
    			<input type="reset"name="Reset" value="重置" >
    			</td>    			
    		</tr>
    		
    		<tr>    <!-- 实现空行 -->		
    		<td  align="center">&nbsp;</td>
    		</tr>
    		
    		<tr>
    			<td colspan="3" align="center" ><c:out value="${requestScope.message}" /></td>
    		</tr>
    	</table>
  </body>
</html>
